home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 1267 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.2 KB

  1. Path: news.ios.com!usenet
  2. From: Keith Boruff <kboruff@village.ios.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: what is the proper way to create header files??
  5. Date: 10 Jan 1996 01:59:31 GMT
  6. Organization: Internet Online Services
  7. Message-ID: <4cv6i3$9dg@news.ios.com>
  8. NNTP-Posting-Host: ppp-61.ts-2.nyc.idt.net
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=us-ascii
  11. Content-Transfer-Encoding: 7bit
  12. X-Mailer: Mozilla 1.1PE (Windows; I; 16bit)
  13.  
  14. I have spent some time scanning the included header files that came with 
  15. my compiler (iostream.h, math.h, cstring.h, etc...). 
  16.  
  17. I have noticed that any functions that can be used from a given header 
  18. file has only its prototype (declaration) listed. The definitions in most 
  19. cases are not to be found in the header files themselves.
  20.  
  21. I had learned some time ago about creating library files. I heard that a 
  22. library should contain an interface (header file) and and implementation 
  23. file. The header file contains all info pertaining to function 
  24. declarations and class declarations. The implementation files contain the 
  25. definitions of any functions. The implementation file is compiled 
  26. separately and then linked to any source file that includes the 
  27. interface. exam: #include "somefile.h"..
  28.  
  29. This is sure the case with all files in my include directory. I cannot 
  30. figure out how including a header file with function declarations will 
  31. automatically include the binary file with its corresponding definitions. 
  32.  
  33. The only way that I can achieve a similiar outcome is by linking my 
  34. driver file and header binary file together in a project. Yet I do not 
  35. have to do this with say: iostream.h, cstring.h, ctype.h...ad nauseum..
  36.  
  37. I would like to be able to do this so that I can hide the ugly details of 
  38. any function definitions and only expose the programmer to what my 
  39. classes, functions offer.  
  40.  
  41. Could someone tell me how this is achieved? I want to be able to include 
  42. my own header files into my driver files without the inconvenience of 
  43. linking two separate files in a project. 
  44.  
  45. Does this method take some extensive knowledge in knowing preprocessor 
  46. directives. I have seen these things smeared all over the *.h text files. 
  47. Any help on this matter would be greatly appreciated. 
  48.  
  49. Keith Boruff
  50.  
  51.